<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/bootstrap-3.3.7-dist/css/bootstrap.css"/>
</head>
<body>
	<table class="table table-striped table-bordered table-hover table-condensed">
		<tr>
			<th>ID</th>
			<th>名字</th>
			<th>年龄</th>
			<th>性别</th>
			<th>班级ID</th>
			<th>班级名字</th>
			<th>删除</th>
		</tr>
		<c:forEach items="${pageInfo.list}" var="student">
			<tr>
				<td>${student.id}</td>
				<td>${student.name}</td>
				<td>${student.age}</td>
				<td>${student.gender}</td>
				<td>${student.banji.id}</td>
				<td>${student.banji.name}</td>
				<td><a href="javascript:void(0)" onclick="deleteById(${student.id})">删除</a></td>
				</tr>
		</c:forEach>
	</table>
	<nav aria-label="Page navigation">
	  <ul class="pagination">
	    <li>
	      <a href="#" aria-label="Previous">
	        <span aria-hidden="true">&laquo;</span>
	      </a>
	    </li>
	    
	    <c:forEach begin="1" end="${pageInfo.totalPage}" var="i">
	    	 <li><a href="${pageContext.request.contextPath}/student/findByPage.action?pageNo=${i}">${i}</a></li>
	    </c:forEach>
	   
	    <li>
	      <a href="#" aria-label="Next">
	        <span aria-hidden="true">&raquo;</span>
	      </a>
	    </li>
	  </ul>
	</nav>

	<script type="text/javascript">
		function deleteById(id) {
			var isDel = confirm("您确认要删除么？");
			if (isDel) {
				location.href = "${pageContext.request.contextPath}/student/deleteById.action?id=" + id;
			}
		}
	</script>
</body>
</html>